"use strict";
const common_vendor = require("../common/vendor.js");
const __unplugin_components_0 = () => "../node-modules/wot-design-uni/components/wd-popup/wd-popup.js";
if (!Array) {
  const _component_wd_popup = __unplugin_components_0;
  _component_wd_popup();
}
const __default__ = {
  options: {
    virtualHost: true,
    addGlobalClass: true,
    styleIsolation: "shared"
  }
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  ...__default__,
  __name: "PrivacyPopup",
  props: {
    title: { default: "用户隐私保护提示" },
    desc: { default: "感谢您使用本应用，您使用本应用的服务之前请仔细阅读并同意" },
    subDesc: { default: "。当您点击同意并开始时用产品服务时，即表示你已理解并同意该条款内容，该条款将对您产生法律约束力。如您拒绝，将无法使用相应服务。" },
    protocol: { default: "《用户隐私保护指引》" }
  },
  emits: ["agree", "disagree"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const showPopup = common_vendor.ref(false);
    const privacyResolves = common_vendor.ref(/* @__PURE__ */ new Set());
    function privacyHandler(resolve) {
      showPopup.value = true;
      privacyResolves.value.add(resolve);
    }
    common_vendor.onBeforeMount(() => {
      if (common_vendor.wx$1.onNeedPrivacyAuthorization) {
        common_vendor.wx$1.onNeedPrivacyAuthorization((resolve) => {
          if (typeof privacyHandler === "function") {
            privacyHandler(resolve);
          }
        });
      }
    });
    function handleAgree() {
      showPopup.value = false;
      privacyResolves.value.forEach((resolve) => {
        resolve({
          event: "agree",
          buttonId: "agree-btn"
        });
      });
      privacyResolves.value.clear();
      emit("agree");
    }
    function handleDisagree() {
      showPopup.value = false;
      privacyResolves.value.forEach((resolve) => {
        resolve({
          event: "disagree"
        });
      });
      privacyResolves.value.clear();
    }
    function openPrivacyContract() {
      common_vendor.wx$1.openPrivacyContract({});
    }
    function handleClose() {
      privacyResolves.value.clear();
    }
    return (_ctx, _cache) => {
      return {
        a: common_vendor.t(_ctx.title),
        b: common_vendor.t(_ctx.desc),
        c: common_vendor.t(_ctx.protocol),
        d: common_vendor.o(openPrivacyContract),
        e: common_vendor.t(_ctx.subDesc),
        f: common_vendor.o(handleDisagree),
        g: common_vendor.o(handleAgree),
        h: common_vendor.o(handleClose),
        i: common_vendor.o(($event) => showPopup.value = $event),
        j: common_vendor.p({
          ["close-on-click-modal"]: false,
          ["custom-class"]: "wd-privacy-popup",
          modelValue: showPopup.value
        })
      };
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3b759913"]]);
wx.createComponent(Component);
